#include "syntax_tree.h"
#include <stdarg.h>
#include <malloc.h>

syntax_t syntax_create(int type,int pno,...){
	va_list ap;
	syntax_node * p;
	syntax_t tree;
	int i;
	if((p=(syntax_node *)malloc(sizeof(syntax_node)))==NULL)
		printf("out of memory");
	p->type=type;
	p->pno=pno;
	tree=(syntax_t)_dsl_multree_alloc((_dsl_element_t)p);
	va_start(ap,pno);
	for(i=0;i<pno;i++)
		_dsl_multree_set_child((_dsl_multree_t)tree,(_dsl_multree_t)va_arg(ap,syntax_t));
	va_end(ap);
	return  tree;
}
syntax_t syntax_get_partment(syntax_t tree,int no)
{
	return (syntax_t)_dsl_multree_get_child((_dsl_multree_t)tree,no);
}
syntax_node * syntax_get_content(syntax_t tree)
{
	return (syntax_node *)_dsl_multree_get_content((_dsl_multree_t) tree);
}
